<?php
class Action extends admin_abs {
	function index() 
	{
		$data = _model('email')->getList('ORDER BY id DESC', new Pager(50));
		Smarty3::instance()->assign($data);
		Smarty3::instance()->display('email.html');
	}
	
	function delete()
	{
		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
			$check = _POST('check', array());
			if (!$check) {
				msg('参数错误');
			}
			foreach ($check as $val) {
				_model('email')->delete(array('id'=>$val));
			}
			redirect('?url=email.html');

		} else {
			$id = _GET('id', 0);
			if (!$id) {
				msg('参数错误');
			} 
			_model('email')->delete(array('id'=>$id));
			redirect('?url=email.html');
		}
	}
}
?>